//
//  File.swift
//
//
//  Created by didi on 2022/9/14.
//

import Molecular
import Vapor

final class UserNewPasswordForm: AbstractForm {
    var password: String = ""

    init() {
        super.init()
        submit = "Set new password"
    }

    @FormFieldBuilder
    override func createFields(_ req: Request) -> [FormField] {
        InputField("password")
            .config {
                $0.output.context.type = .password
            }
            .validators {
                FormFieldValidator.required($1)
            }
            .write { [unowned self] in password = $1.input }
    }
}
